<?php

namespace Home\Controller;

use Think\Controller;

class BlogController extends BaseController {

    public function index() {
        echo \Think\Log::write('这是一条日志');
        $page = I('request.page');
        $page_size = \Think\Constant::PAGESIZE;
        $list = D('Post')->model()->page($page, $page_size)->limit($page_size)->order('post_id desc')->loadList();
        $this->assign('list', $list);
        $this->assign('post_type', \Think\Variable::$post_type);
        $this->display('lists');
    }

    public function lists() {
        $this->index();
    }

    public function info() {
        $post_id = I('post_id', 0, 'intval');
        $info = D('Post')->view('info')->fetch(array('post_id' => $post_id));
        $this->assign('info', $info);
        $this->display();
    }

}
